let Minio = require("minio");
import {addFile} from '@/api/system/file'


let minioClient = new Minio.Client({
  endPoint: 'play.min.io',
  port: 9000,
  useSSL: true,
  accessKey: 'Q3AM3UQ867SPQQA43P2F',
  secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
})

export function upload(file, options = {}) {
  let metaData = {
    'Content-Type': 'application/octet-stream',
    'X-Amz-Meta-Testing': 1234,
    example: 5678,
  }

  let bucketName = 'europetrip';

  minioClient.fPutObject(bucketName, file.name, file, metaData, (err, etag) => {
    if (err) {
      this.$message.error(`服务器连接超时`)
      return err
    } else {

    }
    console.log('File uploaded successfully.')
  })
}
